/**
 * Copyright  (c) 2009-2013 XLab,  Org. 
 * All  rights  reserved. 
 */
package org.xlab.baseframework.common.comparator;

import java.util.Comparator;

import org.xlab.baseframework.service.spi.ISystemInitializationListener;


/**
 * 针对系统初始化监听器的比较器,比较多个监听器的监听顺序
 * 
 * @author MaKuBEX Email:makubexnet@gmail.com
 * @version 1.0.0 Sep 7, 2010
 * @since 1.0.0
 * 
 */
public class SystemListenerComparator implements
		Comparator<ISystemInitializationListener> {

	/**
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(ISystemInitializationListener arg0,
			ISystemInitializationListener arg1) {
		if (arg0.getSequence() == arg1.getSequence()) {
			return 0;
		} else if (arg0.getSequence() > arg1.getSequence()) {
			return 1;
		} else {
			return -1;
		}
	}

}
